package com.ruoyi.epidemic.web;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.epidemic.domain.TbPolicy;
import com.ruoyi.epidemic.service.ITbPolicyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author zyc
 * @createDate 2023/3/21 10:17
 */
@RestController
@RequestMapping("/web/policy")
public class PolicyController extends BaseController {

    @Autowired
    private ITbPolicyService policyService;

    //政策解读列表
    @GetMapping("/list")
    public TableDataInfo getList(@RequestParam(required = false) String title){
        startPage();
        List<TbPolicy> list = policyService.getList(title);
        return getDataTable(list);
    }

    //政策解读详情
    @GetMapping("/info")
    public AjaxResult getOne(@RequestParam  Long id){
        TbPolicy tbPolicy = policyService.selectTbPolicyById(id);
        return AjaxResult.success(tbPolicy);
    }
}
